﻿/// <reference path="../kendo/typescript/kendo.mobile.d.ts" />
/// <reference path="typings/jquery.d.ts" />

import interfaces = require("Interfaces");
import account = require("UserAccount");
import application = require("WindowExtensions");
import movieList = require("MovieList");
import theaterList = require("TheaterMovieList");
import tickets = require("BookTickets");
import trailers = require("Trailers");
// ReSharper disable WrongExpressionStatement
interfaces;
account;
movieList;
theaterList;
tickets;
trailers;
// ReSharper restore WrongExpressionStatement


export function initialize() {
    var app = application.getApplication();

    // Display loading on every ajax call
    $(document).ajaxStart(() => {
        // application.showLoading calls the showLoading() 
        // method of the pane Object inside the app
        // During the app's initial view's init 
        // method this pane object may not be initialized
        // and so application.showLoading() may throw error.
        // To prevent this we need to do a check for existence 
        // application.pane before calling 
        // application.showLoading
        if (app.pane) {
            app.showLoading();
        }
    });

    // Hide loading after ajax call
    $(document).ajaxStop(() => {
        if (app.pane) {
            app.hideLoading();
        }
    });

    
    app.navigate("MovieList.html");
} 
